
--[[

    slimui - Copyright (c) 2011 atom0s, All rights reserved.

    See Copyright notice in slimui.lua
    
]]--

class 'Font: Object' { ... };

----------------------------------------------------------------------------------
-- func: Font.__init__
-- desc: Constructor called when this object is first created.
----------------------------------------------------------------------------------
function Font.__init__( self )
    Object.__init__( self );
end

----------------------------------------------------------------------------------
-- func: Font:Create
-- desc: Not implemented. Error on call.
----------------------------------------------------------------------------------
function Font:Create( parent )
    slimui:err( 'not implemented' );
end

----------------------------------------------------------------------------------
-- func: Font:Bind
-- desc: Binds this font object to the given font.
----------------------------------------------------------------------------------
function Font:Bind( font )
    if font == nil then
        slimui:err( 'Font:Bind - parent font cannot be nil' );
    end
    
    local class = object_getClassName( font );
    if string.lower( class ) ~= 'tfont' then
        slimui:err( 'Font:Bind - cannot bind to objects that are not a font!' );
    end
    
    self._object = font;
    
    return self;
end

----------------------------------------------------------------------------------
-- func: Font:GetName
-- desc: Returns the name of this font.
----------------------------------------------------------------------------------
function Font:GetName( )
    return font_getName( self._object );
end

----------------------------------------------------------------------------------
-- func: Font:SetName
-- desc: Sets the name of this font.
----------------------------------------------------------------------------------
function Font:SetName( name )
    font_setName( self._object, name );
end

----------------------------------------------------------------------------------
-- func: Font:GetSize
-- desc: Returns the size of this font.
----------------------------------------------------------------------------------
function Font:GetSize( )
    return font_getSize( self._object );
end

----------------------------------------------------------------------------------
-- func: Font:SetSize
-- desc: Sets the size of this font.
----------------------------------------------------------------------------------
function Font:SetSize( size )
    font_setSize( self._object, size );
end



--[[ Debug information. ]]--------------------------------------------------------
if ( slimui:isdebug() == true ) then
    slimui:msg( '(Control) font.lua successfully loaded.' );
end